#include<cstdio>
#include<cstring>
#include<queue>
#include<iostream>
using namespace std;

const int MAX_SIZE = 1000;
int ans[MAX_SIZE][MAX_SIZE];
bool vis[MAX_SIZE][MAX_SIZE];
int walk[][2]{
	{2,1},{1,2},{2,-1},{1,-2},{-2,-1},{-1,-2},{-2,1},{-1,2}
};

struct node{
	int x,y;
	int cnt;
	node(int x=0,int y=0,int cnt=0):x(x),y(y),cnt(cnt){
	}
};
queue <node > qu;

int main(){
	int n,m,x,y;
	scanf("%d%d%d%d",&n,&m,&x,&y);
	memset(ans,-1,sizeof(ans));
	qu.push(node(x,y,0));
	vis[x][y] = true;
	ans[x][y] = 0;
	while(!qu.empty()){
		node tt=qu.front();
		qu.pop();
		ans[tt.x][tt.y] = tt.cnt;
		for(int i=0;i<8;i++){
			node next_point = node(tt.x+walk[i][0],tt.y+walk[i][1],tt.cnt+1);
			if(next_point.x >=1 && next_point.x <= n && next_point.y>=1 &&next_point.y <= m && ans[next_point.x][next_point.y]==-1&&!vis[next_point.x][next_point.y]){
				vis[next_point.x][next_point.y]=true;
				qu.push(next_point);
			}
		}
	}
	for(int i=1;i<=n;i++){
		for(int j=1;j<=m;j++){
			printf("%-5d",ans[i][j]);
		}
		printf("\n");
	}
}
